import { defineStore } from 'pinia'
import { ref } from 'vue'

export const EditorStore = defineStore(
    'editor',
    () => {
        const data = ref([])
        const addCodeStore = (value: any) => {
            data.value= value
        }
        const removeCodeStore = () => {
            data.value = []
        }
        const getCodeStore = () => {
            return data.value
        }
        return { data,  addCodeStore, removeCodeStore, getCodeStore }
    },
    {
        persist: {
            key: 'editor',
            storage: localStorage
        }
    }
)
